function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}

function showFadeData() {
    $("body").append('<div id="J-datacomplete" class="data-complete">数据加载完毕</div>');
    setTimeout(function() {
        $("#J-datacomplete").remove();
    }, 1500);
    //$("#pullUp").hide();
}

function shoNoData() {
    //$("#pullUp").hide();
    return "<p class='no-data-tip'>暂无数据</p>";
}
var start = {
    baseUrl: "http://118.89.17.217/api",
    publicKey: "MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsRwOpbpqxaBxO7Uj+rg9t1QZAGy5+b2TTy5hLYTmgjmfNzFEyrBGPUl/CceVUnlOG8YWMSjacBQ/v7+2DQW6Gmp8vVaMTsVHuMA3nM1DORuKqSrBTdpOLfQ1zdQHCTO4RggsSlyLKPBxK2WE1kQX+x060EapBIMj0VXHFzDGmW7lzrOFf47CBNFnwPzcDNvKnuqvQiv62fb++HTkB6B2FOjeNw5K0KZYIKoATXdxIMLyw8169nyLtehKeCrlbVv/xFdKcotx8FjJPRdTr30Wl+EEK2oSIpnGYfj7wf25G6askg0cc3Eks/nmaRdFIDPfF6gd6mWioZjj22MGYiQ2lLWNhoh+J2ZRPouwREC+ZHpS1ncyFFE+If5jnUeMrzXjjI0Fb8Bjyc39PYpi+eeXleWm4NDKmEsLxuKAsIS94ykR392munXVZhh7oC/1cQ/buFowFOfwqnhLnBZGMwyQ6LLZQbKJl84jPOMy76nP0DEBvR60hz6MB1M4qLt8PxjvHJ9xf4WMxwe9fDqMevo+J9nbgE0l3rA2G8dWxMzrLyN2miWDI1unaUreXBqk+L9Q9ljGsl3PdLFa08JWSwI2o6qqL4vUtUMdF3trz/2niuMYAM+7S2E9ZST0Q1cgWfyjY/rjbTAyjpTZiJDg5bT07jT7iPEUjLBzlh7JaFR958cCAwEAAQ==",
    //加密请求参数
    encrypt: function(obj) {
        var arr = [],
            rsa = new JSEncrypt();
        for (var i in obj) {
            arr.push(i + "=" + obj[i]);
        }
        msg = arr.join("&");
        rsa.setPublicKey(this.publicKey);
        return rsa.encrypt(msg);
    },
    //发送ajax请求
    postAjaxReq: function(obj) {
        var config = {
            type: "GET",
            param: {},
            url: "",
            success: function() {},
            error: function() {}
        };
        $.extend(true, config, obj); //得到最终的传递的参数
        var thiz = this,
            _param = thiz.encrypt(config.param); //加密传递的参数
        console.log(config.param);
        $.ajax({
            type: config.type,
            url: thiz.baseUrl + config.url,
            data: {
                "secret": _param
            },
            dataType: "jsonp",
            jsonp: "callback", //传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(一般默认为:callback)
            success: function(data) {
                console.log('success' + data.errmsg);
                if (parseInt(data.errno) == 0) {
                    config.success(data);
                } else {
                    if (config.errorCb) {
                        config.errorCb(data);
                    }
                }
            },
            error: function(data) {
                console.log('error' + data.errmsg);
                if (config.errorCb) {
                    config.errorCb(data);
                }
            }
        });
    }
}
